package com.wenhao.beike;

import java.util.*;

/**
 * @author Wenhao Tong
 * @create 2021-09-03 18:46
 */
public class Main3 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int k = scanner.nextInt();
        int m = scanner.nextInt();
        PriorityQueue<Integer> heavy = new PriorityQueue<>((x1,x2) -> x2 - x1);
        PriorityQueue<Integer> light = new PriorityQueue<>((x1,x2) -> x2 - x1);

        for (int i = 0;i < n;i++) {
            int temp = scanner.nextInt();
            if (temp > m) {
                heavy.add(temp);
            } else {
                light.add(temp);
            }
        }

        int start = n;
        int result = 0;
        int big = 0;
        int small = 0;
        while (n > 0) {
            if (small == 0) {
                for (int i = 0;i <= k && n - k - 1 > 0;i++) {
                    if (light.size() > 0) {
                        small += light.poll();
                    }
                }
            }
            if (big == 0 && heavy.size() > 0) {
                big = heavy.poll();
            }
            if (big > small) {
                result += big;
                big = 0;
                if (n == start) {
                    n--;
                    continue;
                }
                if (n - k - 1 < 0) {
                    result += small;
                }
            } else {
                result += small;
                small = 0;
            }
            n -= (k + 1);
        }
        System.out.println(result);
    }
}
